<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <script src="../js/jquery-3.4.1.min.js"></script>
    <script>
        $(function(){
            //alert(1111);
             $("#btn").click(function () {
                // alert(1111);
                 $.ajax({
                     url:"/user/login",
                     data:{userName:$("#userN").val(),passWord:$("#passW").val()},
                     type:"post",
                     success:function (data) {
                        // alert(data);
                         if(data==1){
                             location.href="/news/list";
                         }else{
                           $("#ei").html("用户名或者密码！");
                         }
                     },
                     error:function(){
                         alert("我错了！！");
                     }
                 });
             });
        });
    </script>
</head>
<body>
       <div id="ei" style="color: red"></div>
        <input type="text" id="userN">
        <input type="text" id="passW">
        <input type="button" id="btn" value="登录">
</body>
</html>